﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using PickExperts2.Class;

namespace PickExperts2.form
{
    public partial class fmBrowse : Form
    {
        private TabControl tab;
        public fmBrowse(string strUrl,TabControl tc)
        {
            InitializeComponent();
            if (strUrl != "")
                exWebBrowse1.Navigate(strUrl);
            tab = tc;
        }

        private void comboBox1_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == 13)
                exWebBrowse1.Navigate(comboBox1.Text);
        }

        private void exWebBrowse1_Navigated(object sender, WebBrowserNavigatedEventArgs e)
        {
            comboBox1.Text = exWebBrowse1.Url.AbsoluteUri.ToString();
        }

        private void exWebBrowse1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
        {
            loadingCircle1.Active = false;
        }

        private void exWebBrowse1_Navigating(object sender, WebBrowserNavigatingEventArgs e)
        {
            loadingCircle1.Active = true;
        }

        private void exWebBrowse1_BeforeNewWindow(object sender, control.WebBrowserExtendedNavigatingEventArgs e)
        {
            e.Cancel = true;
            fmBrowse fh = new fmBrowse(e.Url, tab);
            Class.main cMain = new main();
            if (tab != null)
                cMain.showFormInTab(tab, fh, "浏览器");
        }

    }
}
